package com.terren.webdig.setting.entity;

import java.util.List;

import com.terren.webdig.basic.BasicEntity;
import com.terren.webdig.common.util.Lookup3Hash;

/**
 * u_user表
 *
 */
public class LoginUser extends BasicEntity {
	
	private Integer userId;
	private String userName;
	private String password;
	private String newPassword;// 更改密码时用
	private Integer status;// 用户 status
	private String statusShow;// 用户 status
	private Integer userTypeId;
	private String typeName;

	private String functionJson; // 用户的功能
	private Function firstFunction;// 用户第一个功能
	private List<UserRole> list;
	/**
	 * 角色
	 */
	private String roleIds;
	private String roleNames;
	private List<Role> rolesList;

	public List<Role> getRolesList() {
		return rolesList;
	}

	public void setRolesList(List<Role> rolesList) {
		this.rolesList = rolesList;
	}

	public String getRoleIds() {
		if (roleIds == null) {
			StringBuffer sbff = new StringBuffer();
			if (list != null && list.size() > 0) {
				for (int i = 0; i < list.size(); i++) {
					sbff.append(list.get(i).getRoleId());
					if (i < list.size() - 1) {
						sbff.append(",");
					}
				}
			}
			roleIds = sbff.toString();
		}
		return roleIds;
	}

	public void setRoleIds(String roleIds) {
		this.roleIds = roleIds;
	}

	public String getRoleNames() {
		return roleNames;
	}

	public void setRoleNames(String roleNames) {
		this.roleNames = roleNames;
	}

	public String getFunctionJson() {
		return functionJson;
	}

	public void setFunctionJson(String functionJson) {
		this.functionJson = functionJson;
	}

	public Function getFirstFunction() {
		return firstFunction;
	}

	public void setFirstFunction(Function firstFunction) {
		this.firstFunction = firstFunction;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getNewPassword() {
		return newPassword;
	}

	public void setNewPassword(String newPassword) {
		this.newPassword = newPassword;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getStatusShow() {
		return statusShow;
	}

	public void setStatusShow(String statusShow) {
		this.statusShow = statusShow;
	}

	public Integer getUserTypeId() {
		return userTypeId;
	}

	public void setUserTypeId(Integer userTypeId) {
		this.userTypeId = userTypeId;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	public Long getLoginUserId() {
		if (null != getUserName()) {
			return new Lookup3Hash().toID(getUserName());
		}
		return null;
	}
}
